package 结构型模式.外观模式;

/**
 * 结构
 * Facade (外观)：提供简化的接口，将客户端的请求委派给适当的子系统对象
 * Subsystem Classes (子系统类)：实现子系统的功能，处理外观对象指派的工作
 */

class Computer
{
	void on()
	{
		System.out.println("电脑开机");
	}
	void off()
	{
		System.out.println("电脑关机");
	}
}

class Light
{
	void on()
	{
		System.out.println("开灯");
	}
	void off()
	{
		System.out.println("关灯");
	}
}

class Ai
{
	private Computer computer;
	private Light light;
	
	Ai(Computer computer, Light light) {
		this.computer = computer;
		this.light = light;
	}
	
	void start()
	{
		computer.on();
		light.on();
	}
	void end()
	{
		computer.off();
		light.off();
	}
}


public class Facade 
{
	public static void main(String[] args) 
	{
		Ai ai = new Ai(new Computer(), new Light());
		ai.start();
		ai.end();
	}
}
